package com.huazai.pool;

import java.util.concurrent.*;

/**
 * @author huazai
 * @date 2024/2/20
 */
public class ThreadDemoPool2 {
    public static void main(String[] args) {
        final ExecutorService executorService = new ThreadPoolExecutor(2, 3, 2L, TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(3),
                new ThreadPoolExecutor.DiscardPolicy());
        for (int i = 0; i < 10; i++) {
            executorService.submit(() -> {
                final String s = Thread.currentThread().getName() + "正在办理业务";
                System.out.println("s = " + s);
            });
        }
        executorService.shutdown();
    }
}
